package proxy.jdkproxy;

import proxy.Person;
import sun.misc.ProxyGenerator;

import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author zhangxi
 * @date 2021/2/25
 */
public class test {
    public static void main(String[] args) {
        try {
            Person person = (Person) new JDKMeipo().getInstance(new Girl());
            person.findLove();
            byte[] bytes = ProxyGenerator.generateProxyClass("$Proxy0", new Class[]{Person.class});
            FileOutputStream os = new FileOutputStream("E://$Proxy0.class");
            os.write(bytes);
            os.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
